﻿using System;
using WindowsPhoneEssentials.Threading;

namespace WindowsPhoneEssentials.Testing.Threading
{
    public class TestBackgroundWorker : IBackgroundWorker
    {
        public void DoWork<TResult>(Func<TResult> doWork, Action<BackgroundResult<TResult>> workCompleted)
        {
            workCompleted(new BackgroundResult<TResult>(doWork()));
        }

        public void DoWork(Action doWork, Action<BackgroundResult> workCompleted)
        {
            doWork();
            workCompleted(new BackgroundResult());
        }
    }
}
